import request from '@/utils/request'
import {IAuthority, IDept} from "@/iwb/IConfig";

export function getSidebarMenu () {
  return request({
    url: '/wb/config/sidebar',
    method: 'get'
  })
}


/**
 * 部门菜单查询
 */
export function getDepartment() {
  return request({
    url: '/wb/config/department',
    method: 'get',
  })
}

/**
 * 新增部门信息
 * @param data
 */
export function addDepartment(data: IDept) {
  return request({
    url: '/wb/config/department',
    method: 'post',
    data: data
  })
}

/**
 * 编辑部门信息
 * @param data
 */
export function editDepartment(data: IDept) {
  return request({
    url: '/wb/config/department',
    method: 'put',
    data: data
  })
}

/**
 * 删除部门信息
 */
export function deleteDepartment(id: number) {
  return request({
    url: '/wb/config/department',
    method: 'delete',
    params: {id: id}
  })
}

/**
 * 添加手机授权码
 * @param data
 */
export function addPhoneAuthority(data: IAuthority) {
  return request({
    url: '/wb/config/authority',
    method: 'post',
    data
  })
}

/**
 * 分页查询授权信息
 * @param pageIndex
 * @param pageSize
 */
export function getPhoneAuthority(pageIndex: number, pageSize: number) {
  return request({
    url: '/wb/config/authority',
    method: 'get',
    params: { pageIndex, pageSize }
  })
}

/**
 * 删除授权信息
 * @param loginphone
 */
export function deletePhoneAuthority(loginphone: string) {
  return request({
    url: '/wb/config/authority',
    method: 'delete',
    params: {loginphone: loginphone}
  })
}
/**
 * 查询授权信息
 * @param loginphone
 */
export function searchPhoneAuthority(loginphone: string) {
  return request({
    url: '/wb/config/s/authority',
    method: 'get',
    params: {loginphone: loginphone}
  })
}